package com.ruoyi.rva.be.controller;

import com.ruoyi.rva.framework.domain.RvaMap;
import com.ruoyi.rva.framework.service.IRvaViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;

@Controller
@RequestMapping("/rva/view")
public class RvaViewFileController {

    @Autowired
    private View rvaListExportExcelView;

    @Autowired
    private IRvaViewService rvaViewService;

    @RequestMapping("/{view}/export")
    public ModelAndView exportExcel(@PathVariable("view") String viewId) {
        RvaMap listViewData = rvaViewService.selectListViewData(viewId, null, new RvaMap().rvaPut("pageSize", 100000L));
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setView(rvaListExportExcelView);
        modelAndView.addAllObjects(listViewData);
        return modelAndView;
    }
}
